package org.bt.auth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.bt.common.entity.DataEntity;
import org.bt.common.validator.aspect.Email;
import org.bt.common.validator.aspect.Mobile;
import org.springframework.data.annotation.Id;

/**
 * 用户信息
 *
 * @author tongw
 * @date 2021/8/18
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Accessors(chain = true)
@TableName("user")
public class User extends DataEntity<User> {
    @Id
    @TableId(value = "id", type = IdType.ASSIGN_UUID)
    private String id;

    @TableField(value = "username")
    @ApiModelProperty(value = "用户账号")
    private String username;

    @TableField(value = "name")
    @ApiModelProperty(value = "用户名称")
    private String name;

    @TableField(value = "password")
    @ApiModelProperty(value = "用户密码")
    private transient String password;

    @TableField(value = "salt")
    @ApiModelProperty(value = "密码盐值(Base64加密串)")
    private transient String salt;

    @TableField(value = "email")
    @ApiModelProperty(value = "邮箱地址")
    @Email
    private String email;

    @TableField(value = "phone")
    @ApiModelProperty(value = "手机号")
    @Mobile
    private String phone;

    @TableField(value = "available")
    @ApiModelProperty(value = "可用状态(1:可用; 0:不可用)")
    private int available;

    @TableField(value = "avatar")
    @ApiModelProperty(value = "头像")
    private String avatar;

    @TableField(value = "third_user_username")
    @ApiModelProperty(value = "三方用户表.三方用户账号")
    private String thirdUserUsername;
}
